import service from "@/utils/request"

import LoginWork from "@/utils/LoginWork" 
// 选择指令材料
export interface SelectiveInstructionQueryParms{
    lotNo:string,
    mtlName:string,
    mtlSpec:string,
    pageNum:number,
    pageSize:number,
    purNo:string,
    style:string,
    typeNo:string,
    vendorName:string
}

export interface SelectiveInstructionQueryInterface{
    total?:number,
    dtos:dtosList[]
}

interface dtosList{
    lotNo: string,
    seqNo: null,
    partName: null,
    segment: null,
    mtlTypeNo: null,
    mtlType: string,
    mtlNo: string,
    mtlColor: null,
    mtlName: string,
    mtlSpec: string,
    mtlUnit: string,
    ttlUsage: number,
    stkQty: null,
    inQty: number,
    purType: null
}

export const SelectiveInstructionQuery = (parms:SelectiveInstructionQueryParms) => {
    return service.put<any,SelectiveInstructionQueryInterface>('/pcFactorStockQuery/getPackInLotMtlQuery',parms)
}

// 选择通用材料查询
export interface SelectCommonMaterialsParms{
    mtlName:string,
    mtlNo:string,
    mtlSpec:string,
    mtlTypeL:string,
    mtlTypeS:string,
    pageNum:number,
    pageSize:number
}

export interface SelectCommonMaterialsInterface{
    total?:number,
    dtos:any[]
}

export const SelectCommonMaterials = (parms:SelectCommonMaterialsParms) => {
    return service.put<any,SelectCommonMaterialsInterface>(`/back/getComMtlQuery`,parms)
}

// 分类名称
export const CkassifyName = () => {
    return service.post<any,any>(`/back/getMtlType?levelCode=2&typeNo=U`)
}

// 包材入库明细查询
export interface PackageMaterialStorageDetailsQueryParms{
    lotNo:string,
    mtlName:string,
    sendNo:string,
    slipDateEnd:string,
    slipDateStart:string,
    slipNo:string,
    slipReason:string,
    sysDateEnd:string,
    sysDateStart:string,
    vendorNo:string
}

export const PackageMaterialStorageDetailsQuery = (parms:PackageMaterialStorageDetailsQueryParms) => {
    return service.put<any,any>(`/pcFactorStockQuery/getPackInDetQuery`,parms)
}

// 待入库明细查询
export const QueryDetailsToBeStored = () => {
    return service.get<any,any>(`/pcFactorStockQuery/getPackInTempQuery`)
}

// 待入库明细新增
export const QueryDetailsToBeStoredAdd = (parms:any) => {
    return LoginWork.put<any,any>(`/pcFactorStockQuery/packInTempAdd`,parms)
}

// 待入库明细删除
export const QueryDetailsToBeStoreDelete = (item:any) => {
    return LoginWork.post<any,any>(`/pcFactorStockQuery/packInTempDelete`,item)
}

// 包材入库明细删除
export const PackingMaterialStorageDetailsDeleted = (slipNo:string,item:string) => {
    return LoginWork.post<any,any>(`/pcFactorStockQuery/packInDetDelete?slipNo=${slipNo}&item=${item}`)
}

// 入库批处理新增
export const IncomingBatchProcessingAdded = (parms:any) => {
    return LoginWork.put<any,any>(`/pcFactorStockQuery/packInDetAdd`,parms)
}

// 部门查询
export const VendorQuery = () => {
    return service.get<any,any>(`/back/getVendorCompanyName`)
}

// 厂商
export const vendorNmae = () => {
    let parms:any = {
        pageNum:-1,
        pageSize:""
    }
    return service.put<any,any>(`/back/getVendorSearch?search=${''}`,parms)
}